#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <string>
namespace rbac
{
	namespace uuid_binding{
		
		static boost::uuids::uuid		uuid_create_randomly()
		{
			boost::uuids::random_generator gen;
			return gen();
		}

		/// good format for str:
		///   -# 0123456789abcdef0123456789abcdef
		///   -# 01234567-89ab-cdef-0123456789abcdef
		///   -# {01234567-89ab-cdef-0123456789abcdef}
		///   -# {0123456789abcdef0123456789abcdef}
		static boost::uuids::uuid		string_to_uuid(const std::string& str)throw(std::runtime_error) 
		{
			boost::uuids::string_generator gen;
			return gen(str);
		}

		/// get string like :01234567-89ab-cdef-0123456789abcdef
		static std::string				uuid_to_string(const boost::uuids::uuid& uid)
		{
			return boost::uuids::to_string(uid);
		}
		static std::wstring				uuid_to_wstring(const boost::uuids::uuid& uid)
		{
			return boost::uuids::to_wstring(uid);
		}
	};//namespace uuid_binding

};// namespace rbac